package lily.phs.child;

import lily.phs.object.HereTipa;
import lily.phs.object.ThreeChild;
import lily.phs.urh.R;
import lily.ui.control.MyPopupWindow;



import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.InputType;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.ScrollView;

public class ThreeToSixChildView extends RelativeLayout implements OnFocusChangeListener,OnClickListener{
	View v;
	Paint paint;
	private LinearLayout ll1;
	private int profileid;
	private Context myContext;
	MyPopupWindow mPopupWindow;
	//ScrollView sv;
	private RadioButton rb_w_up_1,rb_w_up_2,rb_w_up_3,rb_w_up_4,
						rb_w_middle_1,rb_w_middle_2,rb_w_middle_3,rb_w_middle_4,
						rb_w_down_1,rb_w_down_2,rb_w_down_3,rb_w_down_4,
						rb_h_up_1,rb_h_up_2,rb_h_up_3,rb_h_up_4,
						rb_h_middle_1,rb_h_middle_2,rb_h_middle_3,rb_h_middle_4,
						rb_h_down_1,rb_h_down_2,rb_h_down_3,rb_h_down_4,
						rb_fypj_zc_1,rb_fypj_zc_2,rb_fypj_zc_3,rb_fypj_zc_4,
						rb_fypj_dtz_1,rb_fypj_dtz_2,rb_fypj_dtz_3,rb_fypj_dtz_4,
						rb_fypj_xs_1,rb_fypj_xs_2,rb_fypj_xs_3,rb_fypj_xs_4,
						rb_fypj_fych_1,rb_fypj_fych_2,rb_fypj_fych_3,rb_fypj_fych_4,
						rb_fypj_cz_1,rb_fypj_cz_2,rb_fypj_cz_3,rb_fypj_cz_4,
						rb_hearing_pass_1,rb_hearing_nopass_1,
						rb_card_no_1,rb_card_no_2,rb_card_no_3,rb_card_no_4,
						rb_card_yes_1,rb_card_yes_2,rb_card_yes_3,rb_card_yes_4,
						rb_fubu_no_1,rb_fubu_no_2,rb_fubu_no_3,rb_fubu_no_4,
						rb_fubu_yes_1,rb_fubu_yes_2,rb_fubu_yes_3,rb_fubu_yes_4;
	private EditText et_name,et_id,
					 et_date_1,et_date_2,et_date_3,et_date_4,
					 et_w_1,et_w_2,et_w_3,et_w_4,
					 et_h_1,et_h_2,et_h_3,et_h_4,
					 et_eye_2,et_eye_3,et_eye_4,
					 et_chuya_1,et_chuya_2,et_chuya_3,et_chuya_4,
					 et_quchi_1,et_quchi_2,et_quchi_3,et_quchi_4,
					 et_xhdb_2,et_xhdb_4,et_xhdb_1,et_xhdb_3,
					 et_other_1,et_other_2,et_other_3,et_other_4;
	
	private RadioGroup rg_weight_1,rg_weight_2,rg_weight_3,rg_weight_4,
					   rg_height_1,rg_height_2,rg_height_3,rg_height_4,
					   rg_hearing_1,
					   rg_card_1,rg_card_2,rg_card_3,rg_card_4,
					   rg_fubu_1,rg_fubu_2,rg_fubu_3,rg_fubu_4;
	
	HereTipa ht;
	ThreeChild tc1,tc2,tc3,tc4;
	
	public ThreeToSixChildView(Context context,int pro) {
		super(context);
		myContext=context;
		this.profileid=pro;
		paint=new Paint();
		paint.setStyle(Paint.Style.STROKE);
        paint.setColor(Color.BLACK);
	}
	
	public void findWeidget(){
		LayoutInflater factory = LayoutInflater.from(myContext);
        v = factory.inflate(R.layout.threetosix_child, null);
        
        ll1=(LinearLayout)v.findViewById(R.id.ll);
		//sv=(ScrollView)this.findViewById(R.id.ScrollView01);
		
		et_name=(EditText)v.findViewById(R.id.et_tsc_name);
		et_id=(EditText)v.findViewById(R.id.et_tsc_id);
		et_name.setInputType(InputType.TYPE_NULL);
		et_id.setInputType(InputType.TYPE_NULL);
		et_date_1=(EditText)v.findViewById(R.id.et_tsc_date_1);
		et_date_2=(EditText)v.findViewById(R.id.et_tsc_date_2);
		et_date_3=(EditText)v.findViewById(R.id.et_tsc_date_3);
		et_date_4=(EditText)v.findViewById(R.id.et_tsc_date_4);
		
		et_date_1.setOnClickListener(this);
		et_date_1.setOnFocusChangeListener(this);
		et_date_2.setOnClickListener(this);
		et_date_2.setOnFocusChangeListener(this);
		et_date_3.setOnClickListener(this);
		et_date_3.setOnFocusChangeListener(this);
		et_date_4.setOnClickListener(this);
		et_date_4.setOnFocusChangeListener(this);
		et_date_1.setInputType(InputType.TYPE_NULL);
		et_date_2.setInputType(InputType.TYPE_NULL);
		et_date_3.setInputType(InputType.TYPE_NULL);
		et_date_4.setInputType(InputType.TYPE_NULL);
		rg_weight_1=(RadioGroup)v.findViewById(R.id.rg_tsc_weight_1);
		rg_weight_2=(RadioGroup)v.findViewById(R.id.rg_tsc_weight_2);
		rg_weight_3=(RadioGroup)v.findViewById(R.id.rg_tsc_weight_3);
		rg_weight_4=(RadioGroup)v.findViewById(R.id.rg_tsc_weight_4);
		et_w_1=(EditText)v.findViewById(R.id.et_tsc_weight_1);
		et_w_2=(EditText)v.findViewById(R.id.et_tsc_weight_2);
		et_w_3=(EditText)v.findViewById(R.id.et_tsc_weight_3);
		et_w_4=(EditText)v.findViewById(R.id.et_tsc_weight_4);
		rb_w_up_1=(RadioButton)v.findViewById(R.id.rb_tsc_w_up_1);
		rb_w_up_2=(RadioButton)v.findViewById(R.id.rb_tsc_w_up_2);
		rb_w_up_3=(RadioButton)v.findViewById(R.id.rb_tsc_w_up_3);
		rb_w_up_4=(RadioButton)v.findViewById(R.id.rb_tsc_w_up_4);
		rb_w_middle_1=(RadioButton)v.findViewById(R.id.rb_tsc_w_middle_1);
		rb_w_middle_2=(RadioButton)v.findViewById(R.id.rb_tsc_w_middle_2);
		rb_w_middle_3=(RadioButton)v.findViewById(R.id.rb_tsc_w_middle_3);
		rb_w_middle_4=(RadioButton)v.findViewById(R.id.rb_tsc_w_middle_4);
		rb_w_down_1=(RadioButton)v.findViewById(R.id.rb_tsc_w_down_1);
		rb_w_down_2=(RadioButton)v.findViewById(R.id.rb_tsc_w_down_2);
		rb_w_down_3=(RadioButton)v.findViewById(R.id.rb_tsc_w_down_3);
		rb_w_down_4=(RadioButton)v.findViewById(R.id.rb_tsc_w_down_4);
		rg_height_1=(RadioGroup)v.findViewById(R.id.rg_tsc_height_1);
		rg_height_2=(RadioGroup)v.findViewById(R.id.rg_tsc_height_2);
		rg_height_3=(RadioGroup)v.findViewById(R.id.rg_tsc_height_3);
		rg_height_4=(RadioGroup)v.findViewById(R.id.rg_tsc_height_4);
		rb_h_up_1=(RadioButton)v.findViewById(R.id.rb_tsc_h_up_1);
		rb_h_up_2=(RadioButton)v.findViewById(R.id.rb_tsc_h_up_2);
		rb_h_up_3=(RadioButton)v.findViewById(R.id.rb_tsc_h_up_3);
		rb_h_up_4=(RadioButton)v.findViewById(R.id.rb_tsc_h_up_4);
		rb_h_middle_1=(RadioButton)v.findViewById(R.id.rb_tsc_h_middle_1);
		rb_h_middle_2=(RadioButton)v.findViewById(R.id.rb_tsc_h_middle_2);
		rb_h_middle_3=(RadioButton)v.findViewById(R.id.rb_tsc_h_middle_3);
		rb_h_middle_4=(RadioButton)v.findViewById(R.id.rb_tsc_h_middle_4);
		rb_h_down_1=(RadioButton)v.findViewById(R.id.rb_tsc_h_down_1);
		rb_h_down_2=(RadioButton)v.findViewById(R.id.rb_tsc_h_down_2);
		rb_h_down_3=(RadioButton)v.findViewById(R.id.rb_tsc_h_down_3);
		rb_h_down_4=(RadioButton)v.findViewById(R.id.rb_tsc_h_down_4);
		et_h_1=(EditText)v.findViewById(R.id.et_tsc_h_1);
		et_h_2=(EditText)v.findViewById(R.id.et_tsc_h_2);
		et_h_3=(EditText)v.findViewById(R.id.et_tsc_h_3);
		et_h_4=(EditText)v.findViewById(R.id.et_tsc_h_4);
		rb_fypj_zc_1=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_zc_1);
		rb_fypj_zc_2=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_zc_2);
		rb_fypj_zc_3=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_zc_3);
		rb_fypj_zc_4=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_zc_4);
		rb_fypj_dtz_1=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_dtz_1);
		rb_fypj_dtz_2=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_dtz_2);
		rb_fypj_dtz_3=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_dtz_3);
		rb_fypj_dtz_4=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_dtz_4);
		rb_fypj_xs_1=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_xs_1);
		rb_fypj_xs_2=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_xs_2);
		rb_fypj_xs_3=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_xs_3);
		rb_fypj_xs_4=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_xs_4);
		rb_fypj_fych_1=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_fych_1);
		rb_fypj_fych_2=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_fych_2);
		rb_fypj_fych_3=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_fych_3);
		rb_fypj_fych_4=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_fych_4);
		rb_fypj_cz_1=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_cz_1);
		rb_fypj_cz_2=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_cz_2);
		rb_fypj_cz_3=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_cz_3);
		rb_fypj_cz_4=(RadioButton)v.findViewById(R.id.rb_tsc_fypj_cz_4);
		rb_fypj_zc_1.setOnClickListener(this);
		rb_fypj_zc_2.setOnClickListener(this);
		rb_fypj_zc_3.setOnClickListener(this);
		rb_fypj_zc_4.setOnClickListener(this);
		rb_fypj_dtz_1.setOnClickListener(this);
		rb_fypj_dtz_2.setOnClickListener(this);
		rb_fypj_dtz_3.setOnClickListener(this);
		rb_fypj_dtz_4.setOnClickListener(this);
		rb_fypj_xs_1.setOnClickListener(this);
		rb_fypj_xs_2.setOnClickListener(this);
		rb_fypj_xs_3.setOnClickListener(this);
		rb_fypj_xs_4.setOnClickListener(this);
		rb_fypj_fych_1.setOnClickListener(this);
		rb_fypj_fych_2.setOnClickListener(this);
		rb_fypj_fych_3.setOnClickListener(this);
		rb_fypj_fych_4.setOnClickListener(this);
		rb_fypj_cz_1.setOnClickListener(this);
		rb_fypj_cz_2.setOnClickListener(this);
		rb_fypj_cz_3.setOnClickListener(this);
		rb_fypj_cz_4.setOnClickListener(this);
		et_eye_2=(EditText)v.findViewById(R.id.et_tsc_eye_2);
		et_eye_3=(EditText)v.findViewById(R.id.et_tsc_eye_3);
		et_eye_4=(EditText)v.findViewById(R.id.et_tsc_eye_4);
		rg_hearing_1=(RadioGroup)v.findViewById(R.id.rg_tsc_hearing_1);
		rb_hearing_pass_1=(RadioButton)v.findViewById(R.id.rb_tsc_hearing_pass_1);
		rb_hearing_nopass_1=(RadioButton)v.findViewById(R.id.rb_tsc_hearing_nopass_1);
		et_chuya_1=(EditText)v.findViewById(R.id.et_tsc_chuya_1);
		et_chuya_2=(EditText)v.findViewById(R.id.et_tsc_chuya_2);
		et_chuya_3=(EditText)v.findViewById(R.id.et_tsc_chuya_3);
		et_chuya_4=(EditText)v.findViewById(R.id.et_tsc_chuya_4);
		et_quchi_1=(EditText)v.findViewById(R.id.et_tsc_quchi_1);
		et_quchi_2=(EditText)v.findViewById(R.id.et_tsc_quchi_2);
		et_quchi_3=(EditText)v.findViewById(R.id.et_tsc_quchi_3);
		et_quchi_4=(EditText)v.findViewById(R.id.et_tsc_quchi_4);
		rg_card_1=(RadioGroup)v.findViewById(R.id.rg_tsc_card_1);
		rg_card_2=(RadioGroup)v.findViewById(R.id.rg_tsc_card_2);
		rg_card_3=(RadioGroup)v.findViewById(R.id.rg_tsc_card_3);
		rg_card_4=(RadioGroup)v.findViewById(R.id.rg_tsc_card_4);
		rb_card_no_1=(RadioButton)v.findViewById(R.id.rb_tsc_card_no_1);
		rb_card_no_2=(RadioButton)v.findViewById(R.id.rb_tsc_card_no_2);
		rb_card_no_3=(RadioButton)v.findViewById(R.id.rb_tsc_card_no_3);
		rb_card_no_4=(RadioButton)v.findViewById(R.id.rb_tsc_card_no_4);
		rb_card_yes_1=(RadioButton)v.findViewById(R.id.rb_tsc_card_yes_1);
		rb_card_yes_2=(RadioButton)v.findViewById(R.id.rb_tsc_card_yes_2);
		rb_card_yes_3=(RadioButton)v.findViewById(R.id.rb_tsc_card_yes_3);
		rb_card_yes_4=(RadioButton)v.findViewById(R.id.rb_tsc_card_yes_4);
		rg_fubu_1=(RadioGroup)v.findViewById(R.id.rg_tsc_fubu_1);
		rg_fubu_2=(RadioGroup)v.findViewById(R.id.rg_tsc_fubu_2);
		rg_fubu_3=(RadioGroup)v.findViewById(R.id.rg_tsc_fubu_3);
		rg_fubu_4=(RadioGroup)v.findViewById(R.id.rg_tsc_fubu_4);
		rb_fubu_no_1=(RadioButton)v.findViewById(R.id.rb_tsc_fubu_no_1);
		rb_fubu_no_2=(RadioButton)v.findViewById(R.id.rb_tsc_fubu_no_2);
		rb_fubu_no_3=(RadioButton)v.findViewById(R.id.rb_tsc_fubu_no_3);
		rb_fubu_no_4=(RadioButton)v.findViewById(R.id.rb_tsc_fubu_no_4);
		rb_fubu_yes_1=(RadioButton)v.findViewById(R.id.rb_tsc_fubu_yes_1);
		rb_fubu_yes_2=(RadioButton)v.findViewById(R.id.rb_tsc_fubu_yes_2);
		rb_fubu_yes_3=(RadioButton)v.findViewById(R.id.rb_tsc_fubu_yes_3);
		rb_fubu_yes_4=(RadioButton)v.findViewById(R.id.rb_tsc_fubu_yes_4);
		et_xhdb_2=(EditText)v.findViewById(R.id.et_tsc_xhdb_2);
		et_xhdb_4=(EditText)v.findViewById(R.id.et_tsc_xhdb_4);
		et_xhdb_1=(EditText)v.findViewById(R.id.et_tsc_xhdb_1);
		et_xhdb_3=(EditText)v.findViewById(R.id.et_tsc_xhdb_3);
		et_other_1=(EditText)v.findViewById(R.id.et_tsc_other_1);
		et_other_2=(EditText)v.findViewById(R.id.et_tsc_other_2);
		et_other_3=(EditText)v.findViewById(R.id.et_tsc_other_3);
		et_other_4=(EditText)v.findViewById(R.id.et_tsc_other_4);
		/*LayoutParams lp=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
		this.addView(v,lp);
		
		MyView mv=new MyView(myContext);
		this.addView(mv,lp);*/
		ht=new HereTipa(myContext);
		ht.selectNameAndCode(profileid);
		tc1=new ThreeChild(myContext);
		tc1.selectThreeChild(profileid, 1);
		tc2=new ThreeChild(myContext);
		tc2.selectThreeChild(profileid, 2);
		tc3=new ThreeChild(myContext);
		tc3.selectThreeChild(profileid, 3);
		tc4=new ThreeChild(myContext);
		tc4.selectThreeChild(profileid, 4);
	}
	
	public void selectData(){
		tc1.selectThreeChild(profileid, 1);
		tc2.selectThreeChild(profileid, 2);
		tc3.selectThreeChild(profileid, 3);
		tc4.selectThreeChild(profileid, 4);
	}
	
	public void addToView(){
		LayoutParams lp=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
		this.addView(v,lp);
		
		MyView mv=new MyView(myContext);
		this.addView(mv,lp);
	}
	
	public void initView(){
		//HereTipa ht=new HereTipa(myContext);
		//ht.selectNameAndCode(profileid);
		if(ht.getHeti_name()!=null){
			et_name.setText(ht.getHeti_name());
		}
		if(ht.getHeti_here_id()!=null){
			et_id.setText(ht.getHeti_here_id());
		}
		//ThreeChild tc=new ThreeChild(myContext);
		//tc.selectThreeChild(profileid, 1);
		et_date_1.setText(tc1.getTtch_date());
		if(tc1.getTtch_weig_value()>0){
			et_w_1.setText(tc1.getTtch_weig_value()+"");
		}
		if(tc1.getTtch_weig_choi()>0){
			switch(tc1.getTtch_weig_choi()){
			case 1:
				rg_weight_1.check(0);
				rb_w_up_1.setChecked(true);
				break;
			case 2:
				rg_weight_1.check(1);
				rb_w_middle_1.setChecked(true);
				break;
			case 3:
				rg_weight_1.check(2);
				rb_w_down_1.setChecked(true);
				break;
			}
		}
		if(tc1.getTtch_heig_value()>0){
			et_h_1.setText(tc1.getTtch_heig_value()+"");
		}
		if(tc1.getTtch_heig_choi()>0){
			switch(tc1.getTtch_heig_choi()){
			case 1:
				rg_height_1.check(0);
				rb_h_up_1.setChecked(true);
				break;
			case 2:
				rg_height_1.check(1);
				rb_h_middle_1.setChecked(true);
				break;
			case 3:
				rg_height_1.check(2);
				rb_h_down_1.setChecked(true);
				break;
			}
		}
		if(tc1.getTtch_sode_appr()>0){
			switch(tc1.getTtch_sode_appr()){
			case 1:
				rb_fypj_zc_1.setChecked(true);
				break;
			case 2:
				rb_fypj_dtz_1.setChecked(true);
				break;
			case 3:
				rb_fypj_xs_1.setChecked(true);
				break;
			case 4:
				rb_fypj_fych_1.setChecked(true);
				break;
			case 5:
				rb_fypj_cz_1.setChecked(true);
				break;
			}
		}
		if(tc1.getTtch_hearing()>0){
			switch(tc1.getTtch_hearing()){
			case 1:
				rg_hearing_1.check(0);
				rb_hearing_pass_1.setChecked(true);
				break;
			case 2:
				rg_hearing_1.check(1);
				rb_hearing_nopass_1.setChecked(true);
				break;
			}
		}
		if(tc1.getTtch_teething()>0){
			et_chuya_1.setText(tc1.getTtch_teething()+"");
		}
		if(tc1.getTtch_cavity()>0){
			et_quchi_1.setText(tc1.getTtch_cavity()+"");
		}
		if(tc1.getTtch_card()>0){
			switch(tc1.getTtch_card()){
			case 1:
				rg_card_1.check(0);
				rb_card_no_1.setChecked(true);
				break;
			case 2:
				rg_card_1.check(1);
				rb_card_yes_1.setChecked(true);
				break;
			}
		}
		if(tc1.getTtch_abdomen()>0){
			switch(tc1.getTtch_abdomen()){
			case 1:
				rg_fubu_1.check(0);
				rb_fubu_no_1.setChecked(true);
				break;
			case 2:
				rg_fubu_1.check(1);
				rb_fubu_yes_1.setChecked(true);
				break;
			}
		}
		if(tc1.getTtch_sanguine()>0){
			et_xhdb_1.setText(tc1.getTtch_sanguine()+"");
		}
		et_other_1.setText(tc1.getTtch_other());
		//4
		//tc.selectThreeChild(profileid, 2);
		et_date_2.setText(tc2.getTtch_date());
		if(tc2.getTtch_weig_value()>0){
			et_w_2.setText(tc2.getTtch_weig_value()+"");
		}
		if(tc2.getTtch_weig_choi()>0){
			switch(tc2.getTtch_weig_choi()){
			case 1:
				rg_weight_2.check(0);
				rb_w_up_2.setChecked(true);
				break;
			case 2:
				rg_weight_2.check(1);
				rb_w_middle_2.setChecked(true);
				break;
			case 3:
				rg_weight_2.check(2);
				rb_w_down_2.setChecked(true);
				break;
			}
		}
		if(tc2.getTtch_heig_value()>0){
			et_h_2.setText(tc2.getTtch_heig_value()+"");
		}
		if(tc2.getTtch_heig_choi()>0){
			switch(tc2.getTtch_heig_choi()){
			case 1:
				rg_height_2.check(0);
				rb_h_up_2.setChecked(true);
				break;
			case 2:
				rg_height_2.check(1);
				rb_h_middle_2.setChecked(true);
				break;
			case 3:
				rg_height_2.check(2);
				rb_h_down_2.setChecked(true);
				break;
			}
		}
		if(tc2.getTtch_sode_appr()>0){
			switch(tc2.getTtch_sode_appr()){
			case 1:
				rb_fypj_zc_2.setChecked(true);
				break;
			case 2:
				rb_fypj_dtz_2.setChecked(true);
				break;
			case 3:
				rb_fypj_xs_2.setChecked(true);
				break;
			case 4:
				rb_fypj_fych_2.setChecked(true);
				break;
			case 5:
				rb_fypj_cz_2.setChecked(true);
				break;
			}
		}
		if(tc2.getTtch_eye()>0){
			et_eye_2.setText(tc2.getTtch_eye()+"");
		}
		if(tc2.getTtch_teething()>0){
			et_chuya_2.setText(tc2.getTtch_teething()+"");
		}
		if(tc2.getTtch_cavity()>0){
			et_quchi_2.setText(tc2.getTtch_cavity()+"");
		}
		if(tc2.getTtch_card()>0){
			switch(tc2.getTtch_card()){
			case 1:
				rg_card_2.check(0);
				rb_card_no_2.setChecked(true);
				break;
			case 2:
				rg_card_2.check(1);
				rb_card_yes_2.setChecked(true);
				break;
			}
		}
		if(tc2.getTtch_abdomen()>0){
			switch(tc2.getTtch_abdomen()){
			case 1:
				rg_fubu_2.check(0);
				rb_fubu_no_2.setChecked(true);
				break;
			case 2:
				rg_fubu_2.check(1);
				rb_fubu_yes_2.setChecked(true);
				break;
			}
		}
		if(tc2.getTtch_sanguine()>0){
			et_xhdb_2.setText(tc2.getTtch_sanguine()+"");
		}
		et_other_2.setText(tc2.getTtch_other());
		//5
		//tc.selectThreeChild(profileid, 3);
		et_date_3.setText(tc3.getTtch_date());
		if(tc3.getTtch_weig_value()>0){
			et_w_3.setText(tc3.getTtch_weig_value()+"");
		}
		if(tc3.getTtch_weig_choi()>0){
			switch(tc3.getTtch_weig_choi()){
			case 1:
				rg_weight_3.check(0);
				rb_w_up_3.setChecked(true);
				break;
			case 2:
				rg_weight_3.check(1);
				rb_w_middle_3.setChecked(true);
				break;
			case 3:
				rg_weight_3.check(2);
				rb_w_down_3.setChecked(true);
				break;
			}
		}
		if(tc3.getTtch_heig_value()>0){
			et_h_3.setText(tc3.getTtch_heig_value()+"");
		}
		if(tc3.getTtch_heig_choi()>0){
			switch(tc3.getTtch_heig_choi()){
			case 1:
				rg_height_3.check(0);
				rb_h_up_3.setChecked(true);
				break;
			case 2:
				rg_height_3.check(1);
				rb_h_middle_3.setChecked(true);
				break;
			case 3:
				rg_height_3.check(2);
				rb_h_down_3.setChecked(true);
				break;
			}
		}
		if(tc3.getTtch_sode_appr()>0){
			switch(tc3.getTtch_sode_appr()){
			case 1:
				rb_fypj_zc_3.setChecked(true);
				break;
			case 2:
				rb_fypj_dtz_3.setChecked(true);
				break;
			case 3:
				rb_fypj_xs_3.setChecked(true);
				break;
			case 4:
				rb_fypj_fych_3.setChecked(true);
				break;
			case 5:
				rb_fypj_cz_3.setChecked(true);
				break;
			}
		}
		if(tc3.getTtch_eye()>0){
			et_eye_3.setText(tc3.getTtch_eye()+"");
		}
		if(tc3.getTtch_teething()>0){
			et_chuya_3.setText(tc3.getTtch_teething()+"");
		}
		if(tc3.getTtch_cavity()>0){
			et_quchi_3.setText(tc3.getTtch_cavity()+"");
		}
		if(tc3.getTtch_card()>0){
			switch(tc3.getTtch_card()){
			case 1:
				rg_card_3.check(0);
				rb_card_no_3.setChecked(true);
				break;
			case 2:
				rg_card_3.check(1);
				rb_card_yes_3.setChecked(true);
				break;
			}
		}
		if(tc3.getTtch_abdomen()>0){
			switch(tc3.getTtch_abdomen()){
			case 1:
				rg_fubu_3.check(0);
				rb_fubu_no_3.setChecked(true);
				break;
			case 2:
				rg_fubu_3.check(1);
				rb_fubu_yes_3.setChecked(true);
				break;
			}
		}
		if(tc3.getTtch_sanguine()>0){
			et_xhdb_3.setText(tc3.getTtch_sanguine()+"");
		}
		et_other_3.setText(tc3.getTtch_other());
		//6
		//tc.selectThreeChild(profileid, 4);
		et_date_4.setText(tc4.getTtch_date());
		if(tc4.getTtch_weig_value()>0){
			et_w_4.setText(tc4.getTtch_weig_value()+"");
		}
		if(tc4.getTtch_weig_choi()>0){
			switch(tc4.getTtch_weig_choi()){
			case 1:
				rg_weight_4.check(0);
				rb_w_up_4.setChecked(true);
				break;
			case 2:
				rg_weight_4.check(1);
				rb_w_middle_4.setChecked(true);
				break;
			case 3:
				rg_weight_4.check(2);
				rb_w_down_4.setChecked(true);
				break;
			}
		}
		if(tc4.getTtch_heig_value()>0){
			et_h_4.setText(tc4.getTtch_heig_value()+"");
		}
		if(tc4.getTtch_heig_choi()>0){
			switch(tc4.getTtch_heig_choi()){
			case 1:
				rg_height_4.check(0);
				rb_h_up_4.setChecked(true);
				break;
			case 2:
				rg_height_4.check(1);
				rb_h_middle_4.setChecked(true);
				break;
			case 3:
				rg_height_4.check(2);
				rb_h_down_4.setChecked(true);
				break;
			}
		}
		if(tc4.getTtch_sode_appr()>0){
			switch(tc4.getTtch_sode_appr()){
			case 1:
				rb_fypj_zc_4.setChecked(true);
				break;
			case 2:
				rb_fypj_dtz_4.setChecked(true);
				break;
			case 3:
				rb_fypj_xs_4.setChecked(true);
				break;
			case 4:
				rb_fypj_fych_4.setChecked(true);
				break;
			case 5:
				rb_fypj_cz_4.setChecked(true);
				break;
			}
		}
		if(tc4.getTtch_eye()>0){
			et_eye_4.setText(tc4.getTtch_eye()+"");
		}
		if(tc4.getTtch_teething()>0){
			et_chuya_4.setText(tc4.getTtch_teething()+"");
		}
		if(tc4.getTtch_cavity()>0){
			et_quchi_4.setText(tc4.getTtch_cavity()+"");
		}
		if(tc4.getTtch_card()>0){
			switch(tc4.getTtch_card()){
			case 1:
				rg_card_4.check(0);
				rb_card_no_4.setChecked(true);
				break;
			case 2:
				rg_card_4.check(1);
				rb_card_yes_4.setChecked(true);
				break;
			}
		}
		if(tc4.getTtch_abdomen()>0){
			switch(tc4.getTtch_abdomen()){
			case 1:
				rg_fubu_4.check(0);
				rb_fubu_no_4.setChecked(true);
				break;
			case 2:
				rg_fubu_4.check(1);
				rb_fubu_yes_4.setChecked(true);
				break;
			}
		}
		if(tc4.getTtch_sanguine()>0){
			et_xhdb_4.setText(tc4.getTtch_sanguine()+"");
		}
		et_other_4.setText(tc4.getTtch_other());
	}
	
	public boolean saveView(){
		if(et_w_1.getText().toString().replaceAll("\\s", "").length()>10||
				et_w_1.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_w_1.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_w_2.getText().toString().replaceAll("\\s", "").length()>10||
				et_w_2.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_w_2.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_w_3.getText().toString().replaceAll("\\s", "").length()>10||
				et_w_3.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_w_3.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_w_4.getText().toString().replaceAll("\\s", "").length()>10||
				et_w_4.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_w_4.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_h_1.getText().toString().replaceAll("\\s", "").length()>10||
				et_h_1.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_h_1.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_h_2.getText().toString().replaceAll("\\s", "").length()>10||
				et_h_2.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_h_2.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_h_3.getText().toString().replaceAll("\\s", "").length()>10||
				et_h_3.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_h_3.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_h_4.getText().toString().replaceAll("\\s", "").length()>10||
				et_h_4.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_h_4.setError("输入的数据长度超过范围");
			return false;
		}
		
		if(et_eye_2.getText().toString().replaceAll("\\s", "").length()>10||
				et_eye_2.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_eye_2.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_eye_3.getText().toString().replaceAll("\\s", "").length()>10||
				et_eye_3.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_eye_3.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_eye_4.getText().toString().replaceAll("\\s", "").length()>10||
				et_eye_4.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_eye_4.setError("输入的数据长度超过范围");
			return false;
		}
		
		if(et_chuya_1.getText().toString().replaceAll("\\s", "").length()>8||
				et_chuya_1.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_chuya_1.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_chuya_2.getText().toString().replaceAll("\\s", "").length()>8||
				et_chuya_2.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_chuya_2.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_chuya_3.getText().toString().replaceAll("\\s", "").length()>8||
				et_chuya_3.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_chuya_3.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_chuya_4.getText().toString().replaceAll("\\s", "").length()>8||
				et_chuya_4.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_chuya_4.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_quchi_1.getText().toString().replaceAll("\\s", "").length()>8||
				et_quchi_1.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_quchi_1.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_quchi_2.getText().toString().replaceAll("\\s", "").length()>8||
				et_quchi_2.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_quchi_2.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_quchi_3.getText().toString().replaceAll("\\s", "").length()>8||
				et_quchi_3.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_quchi_3.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_quchi_4.getText().toString().replaceAll("\\s", "").length()>8||
				et_quchi_4.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_quchi_4.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_xhdb_1.getText().toString().replaceAll("\\s", "").length()>10||
				et_xhdb_1.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_xhdb_1.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_xhdb_2.getText().toString().replaceAll("\\s", "").length()>10||
				et_xhdb_2.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_xhdb_2.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_xhdb_3.getText().toString().replaceAll("\\s", "").length()>10||
				et_xhdb_3.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_xhdb_3.setError("输入的数据长度超过范围");
			return false;
		}
		if(et_xhdb_4.getText().toString().replaceAll("\\s", "").length()>10||
				et_xhdb_4.getText().toString().replaceAll("\\s", "").startsWith("-")){
			et_xhdb_4.setError("输入的数据长度超过范围");
			return false;
		}
		
		ThreeChild tc=new ThreeChild(myContext);
		tc.selectThreeChild(profileid, 1);
		tc.setTtch_date(et_date_1.getText().toString().replaceAll("\\s", ""));
		if(et_w_1.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_weig_value(Float.parseFloat(et_w_1.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_w_up_1.isChecked()){
			tc.setTtch_weig_choi(1);
		}
		else if(rb_w_middle_1.isChecked()){
			tc.setTtch_weig_choi(2);
		}
		else if(rb_w_down_1.isChecked()){
			tc.setTtch_weig_choi(3);
		}
		if(et_h_1.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_heig_value(Float.parseFloat(et_h_1.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_h_up_1.isChecked()){
			tc.setTtch_heig_choi(1);
		}
		else if(rb_h_middle_1.isChecked()){
			tc.setTtch_heig_choi(2);
		}
		else if(rb_h_down_1.isChecked()){
			tc.setTtch_heig_choi(3);
		}
		if(rb_fypj_zc_1.isChecked()){
			tc.setTtch_sode_appr(1);
		}
		else if(rb_fypj_dtz_1.isChecked()){
			tc.setTtch_sode_appr(2);
		}
		else if(rb_fypj_xs_1.isChecked()){
			tc.setTtch_sode_appr(3);
		}
		else if(rb_fypj_fych_1.isChecked()){
			tc.setTtch_sode_appr(4);
		}
		else if(rb_fypj_cz_1.isChecked()){
			tc.setTtch_sode_appr(5);
		}
		if(rb_hearing_pass_1.isChecked()){
			tc.setTtch_hearing(1);
		}
		else if(rb_hearing_nopass_1.isChecked()){
			tc.setTtch_hearing(2);
		}
		if(et_chuya_1.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_teething(Integer.parseInt(et_chuya_1.getText().toString().replaceAll("\\s", "")));
		}
		if(et_quchi_1.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_cavity(Integer.parseInt(et_quchi_1.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_card_no_1.isChecked()){
			tc.setTtch_card(1);
		}
		else if(rb_card_yes_1.isChecked()){
			tc.setTtch_card(2);
		}
		if(rb_fubu_no_1.isChecked()){
			tc.setTtch_abdomen(1);
		}
		else if(rb_fubu_yes_1.isChecked()){
			tc.setTtch_abdomen(2);
		}
		if(et_xhdb_1.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_sanguine(Float.parseFloat(et_xhdb_1.getText().toString().replaceAll("\\s", "")));
		}
		tc.setTtch_other(et_other_1.getText().toString().replaceAll("\\s", ""));
		tc.updateThreeChild(profileid, 1);
		//4
		tc.selectThreeChild(profileid, 2);
		tc.setTtch_date(et_date_2.getText().toString().replaceAll("\\s", "").replaceAll("\\s", ""));
		if(et_w_2.getText().toString().length()>0){
			tc.setTtch_weig_value(Float.parseFloat(et_w_2.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_w_up_2.isChecked()){
			tc.setTtch_weig_choi(1);
		}
		else if(rb_w_middle_2.isChecked()){
			tc.setTtch_weig_choi(2);
		}
		else if(rb_w_down_2.isChecked()){
			tc.setTtch_weig_choi(3);
		}
		if(et_h_2.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_heig_value(Float.parseFloat(et_h_2.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_h_up_2.isChecked()){
			tc.setTtch_heig_choi(1);
		}
		else if(rb_h_middle_2.isChecked()){
			tc.setTtch_heig_choi(2);
		}
		else if(rb_h_down_2.isChecked()){
			tc.setTtch_heig_choi(3);
		}
		if(rb_fypj_zc_2.isChecked()){
			tc.setTtch_sode_appr(1);
		}
		else if(rb_fypj_dtz_2.isChecked()){
			tc.setTtch_sode_appr(2);
		}
		else if(rb_fypj_xs_2.isChecked()){
			tc.setTtch_sode_appr(3);
		}
		else if(rb_fypj_fych_2.isChecked()){
			tc.setTtch_sode_appr(4);
		}
		else if(rb_fypj_cz_2.isChecked()){
			tc.setTtch_sode_appr(5);
		}
		if(et_eye_2.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_eye(Float.parseFloat(et_eye_2.getText().toString().replaceAll("\\s", "")));
		}
		if(et_chuya_2.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_teething(Integer.parseInt(et_chuya_2.getText().toString().replaceAll("\\s", "")));
		}
		if(et_quchi_2.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_cavity(Integer.parseInt(et_quchi_2.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_card_no_2.isChecked()){
			tc.setTtch_card(1);
		}
		else if(rb_card_yes_2.isChecked()){
			tc.setTtch_card(2);
		}
		if(rb_fubu_no_2.isChecked()){
			tc.setTtch_abdomen(1);
		}
		else if(rb_fubu_yes_2.isChecked()){
			tc.setTtch_abdomen(2);
		}
		if(et_xhdb_2.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_sanguine(Float.parseFloat(et_xhdb_2.getText().toString().replaceAll("\\s", "")));
		}
		tc.setTtch_other(et_other_2.getText().toString().replaceAll("\\s", ""));
		tc.updateThreeChild(profileid, 2);
		//5
		tc.selectThreeChild(profileid, 3);
		tc.setTtch_date(et_date_3.getText().toString().replaceAll("\\s", ""));
		if(et_w_3.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_weig_value(Float.parseFloat(et_w_3.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_w_up_3.isChecked()){
			tc.setTtch_weig_choi(1);
		}
		else if(rb_w_middle_3.isChecked()){
			tc.setTtch_weig_choi(2);
		}
		else if(rb_w_down_3.isChecked()){
			tc.setTtch_weig_choi(3);
		}
		if(et_h_3.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_heig_value(Float.parseFloat(et_h_3.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_h_up_3.isChecked()){
			tc.setTtch_heig_choi(1);
		}
		else if(rb_h_middle_3.isChecked()){
			tc.setTtch_heig_choi(2);
		}
		else if(rb_h_down_3.isChecked()){
			tc.setTtch_heig_choi(3);
		}
		if(rb_fypj_zc_3.isChecked()){
			tc.setTtch_sode_appr(1);
		}
		else if(rb_fypj_dtz_3.isChecked()){
			tc.setTtch_sode_appr(2);
		}
		else if(rb_fypj_xs_3.isChecked()){
			tc.setTtch_sode_appr(3);
		}
		else if(rb_fypj_fych_3.isChecked()){
			tc.setTtch_sode_appr(4);
		}
		else if(rb_fypj_cz_3.isChecked()){
			tc.setTtch_sode_appr(5);
		}
		if(et_eye_3.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_eye(Float.parseFloat(et_eye_3.getText().toString().replaceAll("\\s", "")));
		}
		if(et_chuya_3.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_teething(Integer.parseInt(et_chuya_3.getText().toString().replaceAll("\\s", "")));
		}
		if(et_quchi_3.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_cavity(Integer.parseInt(et_quchi_3.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_card_no_3.isChecked()){
			tc.setTtch_card(1);
		}
		else if(rb_card_yes_3.isChecked()){
			tc.setTtch_card(2);
		}
		if(rb_fubu_no_3.isChecked()){
			tc.setTtch_abdomen(1);
		}
		else if(rb_fubu_yes_3.isChecked()){
			tc.setTtch_abdomen(2);
		}
		if(et_xhdb_3.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_sanguine(Float.parseFloat(et_xhdb_3.getText().toString().replaceAll("\\s", "")));
		}
		tc.setTtch_other(et_other_3.getText().toString().replaceAll("\\s", ""));
		tc.updateThreeChild(profileid, 3);
		//6
		tc.selectThreeChild(profileid, 4);
		tc.setTtch_date(et_date_4.getText().toString().replaceAll("\\s", ""));
		if(et_w_4.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_weig_value(Float.parseFloat(et_w_4.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_w_up_4.isChecked()){
			tc.setTtch_weig_choi(1);
		}
		else if(rb_w_middle_4.isChecked()){
			tc.setTtch_weig_choi(2);
		}
		else if(rb_w_down_4.isChecked()){
			tc.setTtch_weig_choi(3);
		}
		if(et_h_4.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_heig_value(Float.parseFloat(et_h_4.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_h_up_4.isChecked()){
			tc.setTtch_heig_choi(1);
		}
		else if(rb_h_middle_4.isChecked()){
			tc.setTtch_heig_choi(2);
		}
		else if(rb_h_down_4.isChecked()){
			tc.setTtch_heig_choi(3);
		}
		if(rb_fypj_zc_4.isChecked()){
			tc.setTtch_sode_appr(1);
		}
		else if(rb_fypj_dtz_4.isChecked()){
			tc.setTtch_sode_appr(2);
		}
		else if(rb_fypj_xs_4.isChecked()){
			tc.setTtch_sode_appr(3);
		}
		else if(rb_fypj_fych_4.isChecked()){
			tc.setTtch_sode_appr(4);
		}
		else if(rb_fypj_cz_4.isChecked()){
			tc.setTtch_sode_appr(5);
		}
		if(et_eye_4.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_eye(Float.parseFloat(et_eye_4.getText().toString().replaceAll("\\s", "")));
		}
		if(et_chuya_4.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_teething(Integer.parseInt(et_chuya_4.getText().toString().replaceAll("\\s", "")));
		}
		if(et_quchi_4.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_cavity(Integer.parseInt(et_quchi_4.getText().toString().replaceAll("\\s", "")));
		}
		if(rb_card_no_4.isChecked()){
			tc.setTtch_card(1);
		}
		else if(rb_card_yes_4.isChecked()){
			tc.setTtch_card(2);
		}
		if(rb_fubu_no_4.isChecked()){
			tc.setTtch_abdomen(1);
		}
		else if(rb_fubu_yes_4.isChecked()){
			tc.setTtch_abdomen(2);
		}
		if(et_xhdb_4.getText().toString().replaceAll("\\s", "").length()>0){
			tc.setTtch_sanguine(Float.parseFloat(et_xhdb_4.getText().toString().replaceAll("\\s", "")));
		}
		tc.setTtch_other(et_other_4.getText().toString().replaceAll("\\s", ""));
		tc.updateThreeChild(profileid, 4);
		return true;
	}
	
	class MyView extends View {
    	View v;
    	Paint paint;
    	
		public MyView(Context context) {
			super(context);
			paint=new Paint();
			paint.setStyle(Paint.Style.STROKE);
            paint.setColor(Color.BLACK);
		}
		
		@Override
		public void onDraw(Canvas c){
	        int top=ll1.getTop();
	        int left=ll1.getLeft()-15;
	        int right=ll1.getRight()+15;
	        int bottom=ll1.getBottom();
	        int y=0;//sv.getScrollY();
	        int height=rb_w_up_1.getHeight();
	        int height2=et_name.getHeight();
	        top=top-y+40;
	        bottom=bottom-y;
	        
	        c.drawLine(left, top+130, right, top+130, paint);
	        c.drawLine(left, top+130+40+1*height, right, top+130+40+1*height, paint);	 
	        c.drawLine(left, top+130+2*40+1*height+1*height2, right, top+130+2*40+1*height+1*height2, paint);
	        c.drawLine(left, top+145+3*40+2*height+2*height2, right, top+145+3*40+2*height+2*height2, paint);
	        c.drawLine(left, top+160+4*40+3*height+3*height2, right, top+160+4*40+3*height+3*height2, paint);
	        c.drawLine(left, top+180+5*40+6*height+3*height2, right, top+180+5*40+6*height+3*height2, paint);
	        c.drawLine(left+35, top+180+6*40+6*height+4*height2, right, top+180+6*40+6*height+4*height2, paint);
	        c.drawLine(left+35, top+180+7*40+7*height+4*height2, right, top+180+7*40+7*height+4*height2, paint);
	        c.drawLine(left+35, top+180+8*40+7*height+5*height2, right, top+180+8*40+7*height+5*height2, paint);
	        c.drawLine(left+35, top+180+9*40+8*height+5*height2, right, top+180+9*40+8*height+5*height2, paint);
	        c.drawLine(left+35, top+180+10*40+9*height+5*height2, right, top+180+10*40+9*height+5*height2, paint);
	        c.drawLine(left+35, top+180+11*40+9*height+6*height2, right, top+180+11*40+9*height+6*height2, paint);
	        c.drawLine(left, top+180+12*40+9*height+7*height2, right, top+180+12*40+9*height+7*height2, paint);
	        
	        c.drawLine(left, top+130, left, top+180+12*40+9*height+7*height2, paint);
	        c.drawLine(right, top+130, right, top+180+12*40+9*height+7*height2, paint);
	        c.drawLine(left+115, top+130, left+115, top+180+12*40+9*height+7*height2, paint);
	        c.drawLine(left+275, top+130, left+275, top+180+12*40+9*height+7*height2, paint);
	        c.drawLine(left+435, top+130, left+435, top+180+12*40+9*height+7*height2, paint);
	        c.drawLine(left+595, top+130, left+595, top+180+12*40+9*height+7*height2, paint);
	        c.drawLine(left+35, top+180+5*40+6*height+3*height2, left+35, top+180+12*40+9*height+7*height2, paint);
	    }
    	
    }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		System.out.println("click");
		if(v==et_date_1){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_tsc_date_1), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_date_1.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_date_2){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_tsc_date_2), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_date_2.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_date_3){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_tsc_date_3), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_date_3.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_date_4){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_tsc_date_4), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_date_4.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==rb_fypj_zc_1){
			rb_fypj_zc_1.setChecked(true);
			rb_fypj_dtz_1.setChecked(false);
			rb_fypj_xs_1.setChecked(false);
			rb_fypj_fych_1.setChecked(false);
			rb_fypj_cz_1.setChecked(false);
		}
		else if(v==rb_fypj_dtz_1){
			rb_fypj_zc_1.setChecked(false);
			rb_fypj_dtz_1.setChecked(true);
			rb_fypj_xs_1.setChecked(false);
			rb_fypj_fych_1.setChecked(false);
			rb_fypj_cz_1.setChecked(false);
		}
		else if(v==rb_fypj_xs_1){
			rb_fypj_zc_1.setChecked(false);
			rb_fypj_dtz_1.setChecked(false);
			rb_fypj_xs_1.setChecked(true);
			rb_fypj_fych_1.setChecked(false);
			rb_fypj_cz_1.setChecked(false);
		}
		else if(v==rb_fypj_fych_1){
			rb_fypj_zc_1.setChecked(false);
			rb_fypj_dtz_1.setChecked(false);
			rb_fypj_xs_1.setChecked(false);
			rb_fypj_fych_1.setChecked(true);
			rb_fypj_cz_1.setChecked(false);
		}
		else if(v==rb_fypj_cz_1){
			rb_fypj_zc_1.setChecked(false);
			rb_fypj_dtz_1.setChecked(false);
			rb_fypj_xs_1.setChecked(false);
			rb_fypj_fych_1.setChecked(false);
			rb_fypj_cz_1.setChecked(true);
		}
		else if(v==rb_fypj_zc_2){
			rb_fypj_zc_2.setChecked(true);
			rb_fypj_dtz_2.setChecked(false);
			rb_fypj_xs_2.setChecked(false);
			rb_fypj_fych_2.setChecked(false);
			rb_fypj_cz_2.setChecked(false);
		}
		else if(v==rb_fypj_dtz_2){
			rb_fypj_zc_2.setChecked(false);
			rb_fypj_dtz_2.setChecked(true);
			rb_fypj_xs_2.setChecked(false);
			rb_fypj_fych_2.setChecked(false);
			rb_fypj_cz_2.setChecked(false);
		}
		else if(v==rb_fypj_xs_2){
			rb_fypj_zc_2.setChecked(false);
			rb_fypj_dtz_2.setChecked(false);
			rb_fypj_xs_2.setChecked(true);
			rb_fypj_fych_2.setChecked(false);
			rb_fypj_cz_2.setChecked(false);
		}
		else if(v==rb_fypj_fych_2){
			rb_fypj_zc_2.setChecked(false);
			rb_fypj_dtz_2.setChecked(false);
			rb_fypj_xs_2.setChecked(false);
			rb_fypj_fych_2.setChecked(true);
			rb_fypj_cz_2.setChecked(false);
		}
		else if(v==rb_fypj_cz_2){
			rb_fypj_zc_2.setChecked(false);
			rb_fypj_dtz_2.setChecked(false);
			rb_fypj_xs_2.setChecked(false);
			rb_fypj_fych_2.setChecked(false);
			rb_fypj_cz_2.setChecked(true);
		}
		else if(v==rb_fypj_zc_3){
			rb_fypj_zc_3.setChecked(true);
			rb_fypj_dtz_3.setChecked(false);
			rb_fypj_xs_3.setChecked(false);
			rb_fypj_fych_3.setChecked(false);
			rb_fypj_cz_3.setChecked(false);
		}
		else if(v==rb_fypj_dtz_3){
			rb_fypj_zc_3.setChecked(false);
			rb_fypj_dtz_3.setChecked(true);
			rb_fypj_xs_3.setChecked(false);
			rb_fypj_fych_3.setChecked(false);
			rb_fypj_cz_3.setChecked(false);
		}
		else if(v==rb_fypj_xs_3){
			rb_fypj_zc_3.setChecked(false);
			rb_fypj_dtz_3.setChecked(false);
			rb_fypj_xs_3.setChecked(true);
			rb_fypj_fych_3.setChecked(false);
			rb_fypj_cz_3.setChecked(false);
		}
		else if(v==rb_fypj_fych_3){
			rb_fypj_zc_3.setChecked(false);
			rb_fypj_dtz_3.setChecked(false);
			rb_fypj_xs_3.setChecked(false);
			rb_fypj_fych_3.setChecked(true);
			rb_fypj_cz_3.setChecked(false);
		}
		else if(v==rb_fypj_cz_3){
			rb_fypj_zc_3.setChecked(false);
			rb_fypj_dtz_3.setChecked(false);
			rb_fypj_xs_3.setChecked(false);
			rb_fypj_fych_3.setChecked(false);
			rb_fypj_cz_3.setChecked(true);
		}
		else if(v==rb_fypj_zc_4){
			rb_fypj_zc_4.setChecked(true);
			rb_fypj_dtz_4.setChecked(false);
			rb_fypj_xs_4.setChecked(false);
			rb_fypj_fych_4.setChecked(false);
			rb_fypj_cz_4.setChecked(false);
		}
		else if(v==rb_fypj_dtz_4){
			rb_fypj_zc_4.setChecked(false);
			rb_fypj_dtz_4.setChecked(true);
			rb_fypj_xs_4.setChecked(false);
			rb_fypj_fych_4.setChecked(false);
			rb_fypj_cz_4.setChecked(false);
		}
		else if(v==rb_fypj_xs_4){
			rb_fypj_zc_4.setChecked(false);
			rb_fypj_dtz_4.setChecked(false);
			rb_fypj_xs_4.setChecked(true);
			rb_fypj_fych_4.setChecked(false);
			rb_fypj_cz_4.setChecked(false);
		}
		else if(v==rb_fypj_fych_4){
			rb_fypj_zc_4.setChecked(false);
			rb_fypj_dtz_4.setChecked(false);
			rb_fypj_xs_4.setChecked(false);
			rb_fypj_fych_4.setChecked(true);
			rb_fypj_cz_4.setChecked(false);
		}
		else if(v==rb_fypj_cz_4){
			rb_fypj_zc_4.setChecked(false);
			rb_fypj_dtz_4.setChecked(false);
			rb_fypj_xs_4.setChecked(false);
			rb_fypj_fych_4.setChecked(false);
			rb_fypj_cz_4.setChecked(true);
		}
		
	}

	@Override
	public void onFocusChange(View v, boolean hasFocus) {
		// TODO Auto-generated method stub
		if(v==et_date_1&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_tsc_date_1  ), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_date_1.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_date_2&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_tsc_date_2  ), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_date_2.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_date_3&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_tsc_date_3  ), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_date_3.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_date_4&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_tsc_date_4  ), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_date_4.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
	}
}
